<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<script>
	$(document).ready(function() {
		$("input[name='trainerId']").select2({
			placeholder: '请选择讲师',
			minimumResultsForSearch: 1,
			minimumInputLength: 2,
			tags: true,
			allowClear: true,
			ajax: {
				type: 'GET',
				url: function(params) {
					return window.__CTX__.root + '/trainers/select-search?query=' + params
				},
				dataType: 'json',
				delay: 1500,
				results: function(response, page, i) {

					if(response.code == '0' || response.code == 0) {
						return {
							results: response.data.trainers
						}
					} else {
						return null;
					}
				},
				cache: true
			}
		})
	})
</script>
<div class="modal-dialog ms-modal-dialog" style="margin-top: 50px;">
	<div class="modal-content">

		<div class="modal-header">
			<button type="button" id="closeBtn" class="close"
				data-dismiss="modal" aria-label="Close">
				<span aria-hidden="true">&times;</span>
			</button>
			<h4 class="modal-title">讲师查询</h4>
		</div>
		<form class="form-horizontal ms-form form-personal-info" method="POST"
			action="${ctx.host}/project-data/${projectPhaseCourseId}/bind-trainer"
			data-validate="true">

			<input type="hidden" name="_method" value="PATCH" />
			<input
				type="hidden" name="projectPhaseCourseId"
				value="${projectPhaseCourseId}" />

			<div class="modal-body">

				<div class="form-group  umu-form-group">
					<label class="control-label col-xs-3">查询讲师：</label>
					<div class="col-xs-8">
						<input type="text" class="select2 form-control" id="trainerId"
							name="trainerId" value="" placeholder="请输入姓名/邮箱进行查询"
							autocomplete="off" tabindex="1" />
					</div>
				</div>
			</div>

			<div class="modal-footer">
				<button type="submit" id="btnSubmit"
					class="btn btn-shadow-success btn-shadow umu-btn">提交</button>
				<button type="button" id="btnCancel"
					class="btn btn-shadow-default btn-shadow umu-btn"
					data-dismiss="modal">取消</button>
			</div>
		</form>

	</div>
</div>